@include('admin.layout.bone_header')

<div class="layui-btn-container">
    <button class="layui-btn" data-type="addImages">提现:({{$info['money']}})</button>
</div>


<table class="layui-hide" id="think-table" lay-filter="think-table"></table>

<script type="text/html" id="barDemo">



</script>

<script>

    layui.use('table', function () {
        let table = layui.table;
        UI.getPageTable(table, "{{route('admins.sbills.sbills')}}", [
            {field: 'sbills_id', title: 'ID', width: 80, sort: true, fixed: 'left'}
            ,{field: 'price', title: '变动金额'}
            ,{field: 'title', title: '标题'}
        ]);

        table.on('tool(think-table)', function (obj) {
            let data = obj.data;
            if(obj.event === 'recharge') {
                layer.prompt({formType:0,title:"充值",value:10000},
                    function(value, index){
                        HttpUtils.post('{{route('admin.users.recharge')}}',{
                            money:value,
                            user_id:data['user_id']
                        },function (res){
                            if(res['code'] != 200){
                                Utils.errorToast(res['msg'])
                                return;
                            }
                            layer.close(index)
                            layui.table.reload("think-table");
                        });
                    });
            }else if(obj.event === 'set_shop'){
                UI.openLayer("{{route('admin.users.set_shop')}}?user_id="+data['user_id'],1080);
            }
        });
        let $ = layui.$, active = {
            addImages:function (){
                UI.openLayer("{{route('admin.sbills.withs')}}",980);
            }
        };
        $('.layui-btn-container .layui-btn').on('click', function () {
            let type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

        $('.search .layui-btn').on('click', function () {
            let type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

    })


</script>


@include('admin.layout.bone_footer')
